package cc.dd.marketing.common;

import lombok.Getter;

/**
 * 活动状态枚举
 *
 * @author dongsufeng
 * @date 2022/9/9 2:23 PM
 */
@Getter
public enum ActivityStatusEnum {
    INITIALIZE(1, "待发布"),
    PROCESSING(2, "进行中"),
    PAUSED(3, "已暂停"),
    TERMINATED(4, "已终止"),
    EXPIRED(5, "已过期");

    private Integer code;
    private String desc;

    ActivityStatusEnum(Integer code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    public static ActivityStatusEnum getByCode(Integer code) {
        if (code == null) {
            return null;
        }
        for (ActivityStatusEnum statusEnum : values()) {
            if (statusEnum.getCode() == code) {
                return statusEnum;
            }
        }
        return null;
    }

}
